package com.codef.sharp.auth.controller;

import java.util.Arrays;
import java.util.Map;

import com.codef.sharp.common.core.response.ResponseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.codef.sharp.auth.entity.SocialAccountEntity;
import com.codef.sharp.auth.service.SocialAccountService;


/**
 * 第三方账户信息表控制层
 *
 * @author zhanrf
 * @date 2022-02-12 19:55:36
 */
@RestController
@RequestMapping("auth/socialaccount")
public class SocialAccountController {
    @Autowired
    private SocialAccountService socialAccountService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public ResponseEntity list(@RequestParam Map<String, Object> params){
        return ResponseEntity.success();
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public ResponseEntity<SocialAccountEntity> info(@PathVariable("id") Long id){
		SocialAccountEntity socialAccount = socialAccountService.getById(id);
        return ResponseEntity.success(socialAccount);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public ResponseEntity<Void> save(@RequestBody SocialAccountEntity socialAccount){
		socialAccountService.save(socialAccount);
        return ResponseEntity.success();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public ResponseEntity<Void> update(@RequestBody SocialAccountEntity socialAccount){
		socialAccountService.updateById(socialAccount);
        return ResponseEntity.success();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public ResponseEntity<Void> delete(@RequestBody Long[] ids){
		socialAccountService.removeByIds(Arrays.asList(ids));
        return ResponseEntity.success();
    }

}
